home *** CD-ROM | disk | FTP | other *** search
/ Info-Mac 3 / Info_Mac_1994-01.iso / Development / Source / Crooked Mouse 1.0 Source / Crooked mouse ƒ / crooked mouse VBL.c next >
Encoding:
C/C++ Source or Header  |  1993-11-14  |  1.8 KB  |  89 lines  |  [TEXT/KAHL]

  1. /**********************************************************************\
  2.  
  3. File:        crooked mouse VBL.c
  4.  
  5. Purpose:    This module handles setting low-level globals that make
  6.             the mouse's movement go at a 45-degree angle (rotated
  7.             counterclockwise) from the way the user moved it.
  8.             
  9.  
  10. Crooked Mouse -=- a mouse rotated 45 degrees
  11. Copyright (C) 1993 Mark Pilgrim
  12.  
  13. This program is free software; you can redistribute it and/or modify
  14. it under the terms of the GNU General Public License as published by
  15. the Free Software Foundation; either version 2 of the License, or
  16. (at your option) any later version.
  17.  
  18. This program is distributed in the hope that it will be useful,
  19. but WITHOUT ANY WARRANTY; without even the implied warranty of
  20. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  21. GNU General Public License for more details.
  22.  
  23. You should have received a copy of the GNU General Public License
  24. along with this program in a file named "GNU General Public License".
  25. If not, write to the Free Software Foundation, 675 Mass Ave,
  26. Cambridge, MA 02139, USA.
  27.  
  28. \**********************************************************************/
  29.  
  30. #include "Retrace.h"
  31.  
  32. extern Boolean CrsrNew : 0x8CE;
  33. extern Point mTemp : 0x828;
  34. extern Point RawMouse : 0x82C;
  35.  
  36. unsigned long    me;
  37. int                oldX, oldY;
  38.  
  39. void header(void);
  40. void main(void);
  41.  
  42. void header(void)
  43. {
  44.     asm {
  45.         dc.l    0
  46.         move.l a0, d0
  47.         lea header, a0
  48.         jmp main
  49.     }
  50. }
  51.  
  52. #include "SetUpA4.h"
  53.  
  54. void main(void)
  55. {
  56.     VBLTask*        myVBL;
  57.     int                vx,vy;
  58.     
  59.     RememberA0();
  60.     SetUpA4();
  61.     
  62.     asm
  63.     {
  64.         move.l d0, myVBL
  65.     }
  66.     
  67.     if (me != '©MSG')
  68.     {
  69.         me = '©MSG';
  70.         oldX=RawMouse.h;
  71.         oldY=RawMouse.v;
  72.     }
  73.     
  74.     vx=RawMouse.h-oldX;
  75.     vy=RawMouse.v-oldY;
  76.     
  77.     RawMouse.h+=vy;
  78.     mTemp.h+=vy;
  79.     RawMouse.v-=vx;
  80.     mTemp.v-=vx;
  81.  
  82.     oldX=RawMouse.h;
  83.     oldY=RawMouse.v;
  84.     
  85.     CrsrNew = TRUE;
  86.     myVBL->vblCount = 1;
  87.     RestoreA4();
  88. }
  89.